<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2024/12/21
  Time: 13:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page import="bean.Course" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    if (session.isNew() || session.getAttribute("user") == null) {
        response.sendRedirect("/index.jsp");
        return;
    }
    if(session.getAttribute("mathelist") == null){
        response.sendRedirect("/MatheAllServlet");
        return;
    }
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>学生选课管理后台-课程列表</title>
    <jsp:include page="/conme/hd.jsp" flush="true" />
    <!--开始::内容-->
    <div class="clear mt-20 mr-15 ml-15">
        <div class="fl">
            <button class="btn btn-warning" onclick="nudop()"><i class="icon-cog"></i>新增</button>
            <button class="btn btn-danger" onclick="nudop()"><i class="icon-trash"></i>删除</button>
            <button class="btn btn-disabled" onclick="location.href = '/MatheAllServlet' "><i class="icon-remove-sign"></i>更新</button>
        </div>
        <div class="fr input-group">
            <form action="#" method="get">
                <input type="text" class="form-control" name="cname" placeholder="课程名称" style="width:290px;"/>
                <button class="btn btn-secondary" onclick="nudop()">搜索</button>
            </form>
        </div>
    </div>
    <table class="table table-bordered mr-15 ml-15 mt-15">
        <thead>
        <tr class="cen">
            <th>学号</th>
            <th>学生姓名</th>
            <th>性别</th>
            <th>所在系</th>
            <th>课程编号</th>
            <th>课程名称</th>
            <th>先修课程</th>
            <th>课程学分</th>
            <th>课程成绩</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody id="list">
        <c:forEach items="${mathelist}" var="ml">
            <tr class="cen">
                <td>${ml.sno}</td>
                <td>${ml.sname}</td>
                <td>${ml.ssex}</td>
                <td>${ml.sdept}</td>
                <td>${ml.cno}</td>
                <td>${ml.cname}</td>
                <td>${ml.cpno}</td>
                <td>${ml.credit}</td>
                <td>${ml.grade}</td>
                <td>
                    <a href="updateServlet?sno=${ml.sno}">修改</a>
                    <a onclick="deletop(${ml.sno})">删除</a>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
    <div class="pagination fr"></div>
    <!--结束::内容-->
    <jsp:include page="/conme/foot.jsp" flush="true" />
    </body>
    <script>
        //待开发提示
        function nudop(){
            alert("联系月月开发吧！")
        }
        ///删除
        function deletop(id){
            layer.confirm('确定删除课程吗？', {
                title:'系统提示',
                btn: ['确定','取消']
            }, function(){
                location.href = 'Delete?cno='+id;
            });
        }
    </script>
</html>


